package cosc617_blackteam;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Laura
 * Iterator of all customers
 */
public class DefaultCustomerIterator implements Iterator<Customer> {
	private ArrayList<Customer> customerList = new ArrayList<Customer>();
	private int index;
	
	public DefaultCustomerIterator(ArrayList<Customer> customerList){
		this.customerList = customerList;
		index = 0;
	}
	@Override
	public boolean hasNext() {
		return index < customerList.size();
	}

	@Override
	public Customer next() {
		Customer customer = null;
		if(hasNext())
			customer = customerList.get(index);
		index++;
		return customer;
	}

	@Override
	public void remove() {
		customerList.remove(index);

	}

}
